//
//  NSString+ZXAvoidCrash.h
//  ZXAvoidCrash
//
//  Created by 朱新明 on 2023/3/27.
//

#import <Foundation/Foundation.h>
#import "ZXAvoidCrashProtocol.h"

NS_ASSUME_NONNULL_BEGIN

@interface NSString (ZXAvoidCrash)<ZXAvoidCrashProtocol>

@end

NS_ASSUME_NONNULL_END


/*
 会崩溃初始化
 //不处理：NULL崩溃但没有异常信息，也无法拦截
 - (instancetype)initWithCharacters:(const unichar *)characters length:(NSUInteger)length;
 //处理：NULL会崩溃
 - (nullable instancetype)initWithUTF8String:(const char *)nullTerminatedCString;
 //处理：nil会崩溃
 - (instancetype)initWithString:(NSString *)aString;
 //不处理：argList=nil会崩溃
 - (instancetype)initWithFormat:(NSString *)format locale:(nullable id)locale arguments:(va_list)argList;
 - (instancetype)initWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);

 会crash方法：
 *  1. - (unichar)characterAtIndex:(NSUInteger)index
 *  2.获取子字符串，返回nil
 *   （1）从from索引开始且包括from：【>=from】
 - (NSString *)substringFromIndex:(NSUInteger)from;
 *   （2）到to索引但不包括to：【<to】
 - (NSString *)substringToIndex:(NSUInteger)to;
 *   （3）根据range获取指定字符串
 - (NSString *)substringWithRange:(NSRange)range;
 
 * 3.返回{NSNotFound, 0}
 - (NSRange)rangeOfString:(NSString *)searchString options:(NSStringCompareOptions)mask range:(NSRange)rangeOfReceiverToSearch locale:(nullable NSLocale *)locale
 * 4.从aSet中找到的第一个字符在字符串中的范围。返回{NSNotFound, 0}
 - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)searchSet options:(NSStringCompareOptions)mask range:(NSRange)rangeOfReceiverToSearch
 * 5.确定组合字符序列；返回{NSNotFound, 0}
 - (NSRange)rangeOfComposedCharacterSequenceAtIndex:(NSUInteger)index;
 - (NSRange)rangeOfComposedCharacterSequencesForRange:(NSRange)range;
 * 6.结合字符串
 - (NSString *)stringByAppendingString:(NSString *)aString;
 */
